/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.hera.process.form.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.hera.base.domain.BaseDomain;

/**
 *
 * @author cmontes
 */
@Entity
@Table(name = "FIELD_OPTION")
public class FieldOption extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy=GenerationType.TABLE, generator="FIELD_OPTION")
    @TableGenerator(name= "FIELD_OPTION", table="sequence", pkColumnName="seq_name", valueColumnName="seq_id", pkColumnValue="FIELDOPTION", allocationSize = 1 )
    @Column(name = "ID_OPTION")
    private Long idOption;
    private String label;
    private String value;
    private Integer sequence;
    @JoinColumn(name = "ID_FIELD", referencedColumnName = "ID_FIELD")
    @ManyToOne
    private FormField formField;
    
    @Column(name = "FLAG_DEFAULT")
    private String flagDefault;

    public FieldOption() {
    }

    public FieldOption(Long idOption) {
        this.idOption = idOption;
    }

    public Long getIdOption() {
        return idOption;
    }

    public void setIdOption(Long idOption) {
        this.idOption = idOption;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Integer getSequence() {
        return sequence;
    }

    public void setSequence(Integer sequence) {
        this.sequence = sequence;
    }
    public FormField getFormField() {
        return formField;
    }

    public void setFormField(FormField formField) {
        this.formField = formField;
    }

    public String getFlagDefault() {
		return flagDefault;
	}

	public void setFlagDefault(String flagDefault) {
		this.flagDefault = flagDefault;
	}

	@Override
    public int hashCode() {
        int hash = 0;
        hash += (idOption != null ? idOption.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof FieldOption)) {
            return false;
        }
        FieldOption other = (FieldOption) object;
        if ((this.idOption == null && other.idOption != null) || (this.idOption != null && !this.idOption.equals(other.idOption))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.hera.process.data.domain2.FieldOption[ idOption=" + idOption + " ]";
    }
    
}
